import java.util.Scanner;
 
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static int count = 0;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            int b = in.nextInt();
            System.out.println(findgbs(a,b));
        }
    }
    public static int findgbs(int a, int b){
        if(a <= 0 && b <= 0)   return 0;
        int s = 1;
        int[] x = {2,3,5,7};
        int c = a;
        int d = b;
        for (int i = 0; i < x.length; i++) {
            if (a % x[i] == 0 && b % x[i] == 0) { // 除尽则继续
                s *=  x[i];
                c = a/x[i];
                d = b/x[i];
                break;
            }else if((a % x[i] != 0 || b % x[i] != 0) && count == 4)  return a * b;
            count ++;
        }
        return s * findgbs(c,d);
    }
}